// Created by Windward Studios - no copyright is claimed. This code can be used in
// any manner by anyone for any reason. There is no copyright of any kind on it. You may
// use it in commercial products. You may change it without sharing those changes.
// We ask that you keep the "created by Windward Studios" in a comment at the top.

using System.Web.UI;

namespace Kailua.net.windward.utils.web
{
	/// <summary>
	/// Useful utilities on the web request object.
	/// </summary>
	public class RequestUtils
	{

		///<summary>
		/// Returns the full URL of a page request.
		///</summary>
		///<param name="page">The page the url is relative to.</param>
		///<param name="url">The relative url.</param>
		///<returns></returns>
		public static string FullUrl(Page page, string url)
		{
			return page.Request.Url.Scheme + "://" + page.Request.Url.Host +
			       (page.Request.Url.Port == 80 ? "" : ":" + page.Request.Url.Port) +
			       page.ResolveUrl(url);
		}
	}
}